<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
  <title>H+移动工作平台 - 预算详情</title>
  <link href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css" rel="stylesheet">
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
  <link rel="stylesheet" href="../css/styles.css">
  <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
</head>
<body>
  <div class="device-container">
    <!-- 状态栏 -->
    <div class="status-bar">
      <div class="status-bar-left">
        <span class="time">9:41</span>
      </div>
      <div class="status-bar-right">
        <i class="fas fa-signal signal"></i>
        <i class="fas fa-wifi wifi"></i>
        <i class="fas fa-battery-full battery"></i>
      </div>
    </div>
    
    <!-- 导航栏 -->
    <div class="nav-bar">
      <div class="nav-left">
        <a href="budget.html"><i class="fas fa-arrow-left"></i></a>
      </div>
      <div class="nav-title">预算详情</div>
      <div class="nav-right">
        <i class="fas fa-download"></i>
      </div>
    </div>
    
    <!-- 内容区域 -->
    <div class="app-content">
      <!-- 预算周期选择 -->
      <div class="p-4 bg-white">
        <div class="flex justify-between items-center">
          <div class="relative w-1/2">
            <select class="w-full bg-gray-100 border-0 rounded-lg py-2 pl-3 pr-8 text-sm appearance-none">
              <option>2024年度</option>
              <option>2023年度</option>
              <option>2022年度</option>
            </select>
            <div class="absolute inset-y-0 right-0 flex items-center px-2 pointer-events-none">
              <i class="fas fa-chevron-down text-gray-400 text-xs"></i>
            </div>
          </div>
          <div class="relative w-1/2 ml-2">
            <select class="w-full bg-gray-100 border-0 rounded-lg py-2 pl-3 pr-8 text-sm appearance-none">
              <option>内科部门</option>
              <option>外科部门</option>
              <option>儿科部门</option>
              <option>妇产科部门</option>
              <option>急诊部门</option>
            </select>
            <div class="absolute inset-y-0 right-0 flex items-center px-2 pointer-events-none">
              <i class="fas fa-chevron-down text-gray-400 text-xs"></i>
            </div>
          </div>
        </div>
      </div>
      
      <!-- 预算概览图表 -->
      <div class="p-4">
        <div class="card">
          <div class="card-header">
            <span>预算使用趋势</span>
            <div class="flex items-center">
              <div class="w-3 h-3 rounded-full bg-blue-500 mr-1"></div>
              <span class="text-xs text-gray-500 mr-2">预算</span>
              <div class="w-3 h-3 rounded-full bg-green-500 mr-1"></div>
              <span class="text-xs text-gray-500">实际</span>
            </div>
          </div>
          <div class="card-body">
            <canvas id="budgetChart" height="200"></canvas>
          </div>
        </div>
      </div>
      
      <!-- 预算分类详情 -->
      <div class="card mx-4 mb-4">
        <div class="card-header">
          <span>预算分类详情</span>
          <div class="text-xs text-gray-500">单位：元</div>
        </div>
        <div class="card-body p-0">
          <!-- 设备采购预算 -->
          <div class="list-item">
            <div>
              <div class="flex items-center">
                <i class="fas fa-laptop-medical text-blue-500 mr-2"></i>
                <span>设备采购</span>
              </div>
              <div class="mt-1">
                <div class="w-full bg-gray-200 rounded-full h-1.5">
                  <div class="bg-blue-500 h-1.5 rounded-full" style="width: 45%"></div>
                </div>
                <div class="flex justify-between text-xs text-gray-500 mt-1">
                  <span>已使用: ¥180,000.00 (45%)</span>
                  <span>总额: ¥400,000.00</span>
                </div>
              </div>
            </div>
            <i class="fas fa-chevron-right text-gray-400"></i>
          </div>
          
          <!-- 培训预算 -->
          <div class="list-item">
            <div>
              <div class="flex items-center">
                <i class="fas fa-graduation-cap text-green-500 mr-2"></i>
                <span>培训费用</span>
              </div>
              <div class="mt-1">
                <div class="w-full bg-gray-200 rounded-full h-1.5">
                  <div class="bg-green-500 h-1.5 rounded-full" style="width: 30%"></div>
                </div>
                <div class="flex justify-between text-xs text-gray-500 mt-1">
                  <span>已使用: ¥60,000.00 (30%)</span>
                  <span>总额: ¥200,000.00</span>
                </div>
              </div>
            </div>
            <i class="fas fa-chevron-right text-gray-400"></i>
          </div>
          
          <!-- 办公用品预算 -->
          <div class="list-item">
            <div>
              <div class="flex items-center">
                <i class="fas fa-pencil-alt text-yellow-500 mr-2"></i>
                <span>办公用品</span>
              </div>
              <div class="mt-1">
                <div class="w-full bg-gray-200 rounded-full h-1.5">
                  <div class="bg-yellow-500 h-1.5 rounded-full" style="width: 15%"></div>
                </div>
                <div class="flex justify-between text-xs text-gray-500 mt-1">
                  <span>已使用: ¥15,000.00 (15%)</span>
                  <span>总额: ¥100,000.00</span>
                </div>
              </div>
            </div>
            <i class="fas fa-chevron-right text-gray-400"></i>
          </div>
          
          <!-- 差旅预算 -->
          <div class="list-item">
            <div>
              <div class="flex items-center">
                <i class="fas fa-plane text-purple-500 mr-2"></i>
                <span>差旅费用</span>
              </div>
              <div class="mt-1">
                <div class="w-full bg-gray-200 rounded-full h-1.5">
                  <div class="bg-purple-500 h-1.5 rounded-full" style="width: 25%"></div>
                </div>
                <div class="flex justify-between text-xs text-gray-500 mt-1">
                  <span>已使用: ¥37,500.00 (25%)</span>
                  <span>总额: ¥150,000.00</span>
                </div>
              </div>
            </div>
            <i class="fas fa-chevron-right text-gray-400"></i>
          </div>
          
          <!-- 会议预算 -->
          <div class="list-item">
            <div>
              <div class="flex items-center">
                <i class="fas fa-users text-red-500 mr-2"></i>
                <span>会议费用</span>
              </div>
              <div class="mt-1">
                <div class="w-full bg-gray-200 rounded-full h-1.5">
                  <div class="bg-red-500 h-1.5 rounded-full" style="width: 10%"></div>
                </div>
                <div class="flex justify-between text-xs text-gray-500 mt-1">
                  <span>已使用: ¥8,000.00 (10%)</span>
                  <span>总额: ¥80,000.00</span>
                </div>
              </div>
            </div>
            <i class="fas fa-chevron-right text-gray-400"></i>
          </div>
          
          <!-- 其他预算 -->
          <div class="list-item">
            <div>
              <div class="flex items-center">
                <i class="fas fa-ellipsis-h text-gray-500 mr-2"></i>
                <span>其他费用</span>
              </div>
              <div class="mt-1">
                <div class="w-full bg-gray-200 rounded-full h-1.5">
                  <div class="bg-gray-500 h-1.5 rounded-full" style="width: 7%"></div>
                </div>
                <div class="flex justify-between text-xs text-gray-500 mt-1">
                  <span>已使用: ¥4,900.00 (7%)</span>
                  <span>总额: ¥70,000.00</span>
                </div>
              </div>
            </div>
            <i class="fas fa-chevron-right text-gray-400"></i>
          </div>
        </div>
      </div>
      
      <!-- 预算调整记录 -->
      <div class="card mx-4 mb-4">
        <div class="card-header">
          <span>预算调整记录</span>
        </div>
        <div class="card-body p-0">
          <div class="list-item">
            <div>
              <div class="font-medium">设备采购预算调整</div>
              <div class="text-xs text-gray-500 mt-1">2024-03-15 | +¥50,000.00</div>
              <div class="text-xs text-gray-500 mt-1">调整原因：新增医疗设备采购需求</div>
            </div>
            <span class="tag tag-green">已批准</span>
          </div>
          
          <div class="list-item">
            <div>
              <div class="font-medium">培训费用预算调整</div>
              <div class="text-xs text-gray-500 mt-1">2024-02-20 | -¥20,000.00</div>
              <div class="text-xs text-gray-500 mt-1">调整原因：部分培训改为线上形式</div>
            </div>
            <span class="tag tag-green">已批准</span>
          </div>
          
          <div class="list-item">
            <div>
              <div class="font-medium">差旅费用预算调整</div>
              <div class="text-xs text-gray-500 mt-1">2024-01-10 | +¥30,000.00</div>
              <div class="text-xs text-gray-500 mt-1">调整原因：增加外地医院交流次数</div>
            </div>
            <span class="tag tag-green">已批准</span>
          </div>
        </div>
      </div>
    </div>
  </div>
  
  <script>
    // 预算图表
    document.addEventListener('DOMContentLoaded', function() {
      const ctx = document.getElementById('budgetChart').getContext('2d');
      const budgetChart = new Chart(ctx, {
        type: 'line',
        data: {
          labels: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],
          datasets: [
            {
              label: '预算',
              data: [100000, 200000, 300000, 400000, 500000, 600000, 700000, 800000, 900000, 1000000, 1100000, 1200000],
              borderColor: 'rgba(59, 130, 246, 1)',
              backgroundColor: 'rgba(59, 130, 246, 0.1)',
              borderWidth: 2,
              pointBackgroundColor: 'rgba(59, 130, 246, 1)',
              tension: 0.4,
              fill: true
            },
            {
              label: '实际',
              data: [80000, 170000, 320560, null, null, null, null, null, null, null, null, null],
              borderColor: 'rgba(16, 185, 129, 1)',
              backgroundColor: 'rgba(16, 185, 129, 0.1)',
              borderWidth: 2,
              pointBackgroundColor: 'rgba(16, 185, 129, 1)',
              tension: 0.4,
              fill: true
            }
          ]
        },
        options: {
          responsive: true,
          maintainAspectRatio: false,
          plugins: {
            legend: {
              display: false
            },
            tooltip: {
              mode: 'index',
              intersect: false,
              callbacks: {
                label: function(context) {
                  let label = context.dataset.label || '';
                  return '¥' + context.raw.toLocaleString('zh-CN');
                }
              }
            }
          },
          scales: {
            x: {
              grid: {
                display: false
              }
            },
            y: {
              beginAtZero: true,
              ticks: {
                callback: function(value) {
                  return '¥' + (value / 10000) + '万';
                }
              }
            }
          }
        }
      });
    });
    
    // 点击预算分类项跳转到详情页面
    document.querySelectorAll('.list-item').forEach(item => {
      item.addEventListener('click', function() {
        window.location.href = 'budget_records.html';
      });
    });
  </script>
</body>
</html>
